package 设计模式.工厂设计模式.SimpleFactoryPattern;

public class SimpleFactory {
    public static IProduce getProduce(String type){
        IProduce produce = null;
        if("1".equals(type)){
            produce = new ProduceA1();
            produce.produce();
        }else if("2".equals(type)){
            produce = new ProduceA2();
            produce.produce();
        }else if ("3".equals(type)){
            produce = new ProduceB1();
            produce.produce();
        }else{
            produce = new ProduceB2();
            produce.produce();
        }
        return produce;
    }

    public static void main(String[] args) {
        SimpleFactory.getProduce("1");

        SimpleFactory.getProduce("2");

        SimpleFactory.getProduce("3");

        SimpleFactory.getProduce("4");
    }
}
